﻿using System;

using Game.Types;

namespace Game.Editor.Toolbox
{
    public class MapItemTypeEventArgs : EventArgs
    {
        readonly IMapItemType _MapItemType;
        
        public MapItemTypeEventArgs(IMapItemType type)
        {
            _MapItemType = type;
        }
            
        public IMapItemType MapItemType
        {
            get { return _MapItemType; }
        }
    }
    
    public static class SelectedMapItemType
    {
        public static event EventHandler<MapItemTypeEventArgs> Selected;
        
        static IMapItemType _MapItemType;
        
        public static IMapItemType MapItemType
        {
            get { return _MapItemType; }
            set 
            {
                if (_MapItemType != value)
                {
                    _MapItemType = value; 
                    FireSelected();
                }
            }
        }
        
        static void FireSelected()
        {
            if (Selected != null)
            {
                Selected(_MapItemType, new MapItemTypeEventArgs(_MapItemType));
            }
        }
        
    }
}
